home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / NET / FLOW.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  2KB  |  100 lines

  1. /*
  2.  *
  3.  *    Flow based forwarding rules (usage: firewalling, etc)
  4.  *
  5.  */
  6.  
  7. #ifndef _NET_FLOW_H
  8. #define _NET_FLOW_H
  9.  
  10. struct flowi {
  11.     int    proto;        /*    {TCP, UDP, ICMP}    */
  12.  
  13.     union {
  14.         struct {
  15.             __u32            daddr;
  16.             __u32            saddr;
  17.         } ip4_u;
  18.         
  19.         struct {
  20.             struct in6_addr *    daddr;
  21.             struct in6_addr *    saddr;
  22.         } ip6_u;
  23.     } nl_u;
  24. #define fl6_dst        nl_u.ip6_u.daddr
  25. #define fl6_src        nl_u.ip6_u.saddr
  26. #define fl4_dst        nl_u.ip4_u.daddr
  27. #define fl4_src        nl_u.ip4_u.saddr
  28.  
  29.     int    oif;
  30.  
  31.     union {
  32.         struct {
  33.             __u16    sport;
  34.             __u16    dport;
  35.         } ports;
  36.  
  37.         struct {
  38.             __u8    type;
  39.             __u8    code;
  40.         } icmpt;
  41.  
  42.         unsigned long    data;
  43.     } uli_u;
  44. };
  45.  
  46. #define FLOWR_NODECISION    0    /* rule not appliable to flow    */
  47. #define FLOWR_SELECT        1    /* flow must follow this rule    */
  48. #define FLOWR_CLEAR        2    /* priority level clears flow    */
  49. #define FLOWR_ERROR        3
  50.  
  51. struct fl_acc_args {
  52.     int    type;
  53.  
  54.  
  55. #define FL_ARG_FORWARD    1
  56. #define FL_ARG_ORIGIN    2
  57.  
  58.     union {
  59.         struct sk_buff        *skb;
  60.         struct {
  61.             struct sock    *sk;
  62.             struct flowi    *flow;
  63.         } fl_o;
  64.     } fl_u;
  65. };
  66.  
  67.  
  68. struct pkt_filter {
  69.     atomic_t        refcnt;
  70.     unsigned int        offset;
  71.     __u32            value;
  72.     __u32            mask;
  73.     struct pkt_filter    *next;
  74. };
  75.  
  76. #define FLR_INPUT        1
  77. #define FLR_OUTPUT        2
  78.  
  79. struct flow_filter {
  80.     int                type;
  81.     union {
  82.         struct pkt_filter    *filter;
  83.         struct sock        *sk;
  84.     } u;
  85. };
  86.  
  87. struct flow_rule {
  88.     struct flow_rule_ops        *ops;
  89.     unsigned char            private[0];
  90. };
  91.  
  92. struct flow_rule_ops {
  93.     int            (*accept)(struct rt6_info *rt,
  94.                       struct rt6_info *rule,
  95.                       struct fl_acc_args *args,
  96.                       struct rt6_info **nrt);
  97. };
  98.  
  99. #endif
  100.